package com.xuzm.demo.util;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;

@Component
public class AppSettingsUtil {

  /** 数据导出路径 */
  public static String dataExportPath;
  /** 数据导出路径_生成zip的路径 */
  public static String dataExportZipPath;
  /** 数据导出路径_生成批量数据zip的路径(会删除历史的文件，保留上一次操作的文件) */
  public static String dataExportBatchDataZip;
  /** 数据导入文件路径 */
  public static String dataImportPath;
  /** 数据导入文件路径_zip解压后的路径 */
  public static String dataImportUnZipPath;
  /** 个人训练情况登记导出路径 */
  public static String personTrainRegisterFilePath;
  /** 训练报告模版存放路径 */
  public static String templateFilePath;
  /** 态势地图路径*/
  public static String mapServerUrl;

  @Autowired
  AppSettingsConfig configAutowired;

  private static AppSettingsConfig config;

  @PostConstruct
  public void init() {
    config = this.configAutowired;
    mapServerUrl = "http://" + getMapServer() + ":"+ getMapPort();
  }

  public static String[] getDbNames(){
    return config.getDbNames();
  }
  public static String[] getFileSuffix(){
    return config.getFileSuffix();
  }
  public static String getDbType(){
    return config.getDbType();
  }
  public static String getMysqlDriver(){
    return config.getMysqlDriver();
  }
  public static String getOracleDriver(){
    return config.getOracleDriver();
  }

  public static Integer getCheckTimeOut() {
    return config.getCheckTimeOut();
  }

  public static String getUploadHome() {
    return config.getUploadHome();
  }

  public static String getBaseOrgID() {
    return config.getBaseOrgID();
  }

  public static String getFtpServer() {
    return config.getFtpServer();
  }

  public static String getFileRoot() {
    return config.getFileRoot();
  }

  public static String getFtpUser() {
    return config.getFtpUser();
  }

  public static String getFtpPassword() {
    return config.getFtpPassword();
  }

  public static String getDataVerson() {
    return config.getDataVersion();
  }

  public static String getExpFilePath(){
    return config.getExpFilePath();
  }

  public static String getHtmlFilePath(){
    return config.getHtmlFilePath();
  }

  public static String getMapServer(){
    return config.getMapServer();
  }

  public static String getMapPort(){
    return config.getMapPort();
  }

  public static String getHeatbeatUrl(){
    return config.getHeatbeatUrl();
  }

  public static String getBreakPointUploadDir(){
    return config.getBreakPointUploadDir();
  }

  public static String getQuestionUrl() {
    return config.getQuestionUrl();
  }

  public static String getQuestionDelete() {
    return config.getQuestionDelete();
  }

  public static String getQuestionRecover() {
    return config.getQuestionRecover();
  }

  public static String getQuestionSaveList() {
    return config.getQuestionSaveList();
  }

  public static Boolean getQuestionSaveStatus() {
    return config.getQuestionSaveStatus();
  }


  public static boolean getSelectAuditEnable(){
    Boolean enable = config.getSelectAuditEnable();
    if(enable == null){
      return false;
    }
    return enable;
  }
}
